package unit04.day01;

import java.io.File;

/**
 * 获取一个目录中所有子项
 * @author cola
 *
 */
public class FileDemo3 {

	public static void main(String[] args) {
		File dir = new File(".");
		if(dir.isDirectory()) {
			//listFiles()获取所有子项
			File[] subs = dir.listFiles();
			for(File sub:subs) {
				if(sub.isFile()) {
					System.out.print("文件:");
				}else {
					System.out.print("目录:");
				}
				System.out.println(sub.getName());
			}
		}
	}

}
